import matplotlib.pyplot as plt

# 费用名称
categories = ['Administration Expense', 'Research and Development Expenditure', 'Financial Expense']

# 2023年的费用数据
expenses_2023 = [32685342.34, 43762675.18, 70446098.68]

# 增幅数据
increase_rates = [-2.71, 12.73, -2.96]  # 注意：增幅数据需要转换为小数形式

# 创建x轴的标签位置
x = range(len(categories))

# 设置图表大小
plt.figure(figsize=(10, 6))

# 绘制柱状图
plt.bar(x, expenses_2023, width=0.4, label='2023 Expenses (Yuan)', color='skyblue' )

# 绘制折线图
plt.plot(x, increase_rates, marker='o', linestyle='-', label='Increase Rate (%)', color='red', markerfacecolor='red', markersize=8)

# 添加标题和标签
plt.title('Expenses and Increase Rates Comparison')
plt.xlabel('Expenses Type')
plt.ylabel('Expenses Amount (Yuan) / Increase Rate (%)')

# 添加图例
plt.legend()

# 设置x轴的标签
plt.xticks(x, categories)

# 显示网格
plt.grid(True, which='both', linestyle='--', linewidth=0.5)

# 显示图表
plt.show()